<template>
  <!--  确认入库信息 -->
  <div id="adduser">
    <el-dialog  title="信息详情" :visible.sync="dialogVisible" width="40%" top="3vh">
      <div v-loading="loading" style="width:90%;margin: 0 auto;padding-bottom:20px;">
        <caigou :act="datas.isDone==1?7:(datas.isDone==0?4:5)"></caigou>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">申请人：</p><a class="man">{{datas.username}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">部门：</p><a class="man">{{datas.depName}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">物品名称：</p><a class="man">{{datas.name}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">物品类型：</p><a class="man">{{id_name(datas.typeId,$store.state.user.leidata)}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">尺寸：</p><a class="man">{{datas.size}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">型号：</p><a class="man">{{datas.model}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox" v-show="datas.sku">
          <span class="sp1"><p class="min">物料编码：</p><a class="man">{{datas.sku}}</a></span>
        </div>
        <div style="margin-top:10px;height:50px" class="tabbox" v-show="datas.remarks">
          <span class="sp1"><p class="min">物品备注：</p><a class="man">{{datas.remarks}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">申请数量：</p><a class="man">{{datas.amount}}</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">单价：</p><a class="man">{{datas.price}} ￥</a></span>
        </div>
        <div style="margin-top:10px;" class="tabbox">
          <span class="sp1"><p class="min">总金额：</p><a class="man">{{datas.price*datas.amount}} ￥</a></span>
        </div>
        <div style="margin-top:10px;height:50px" class="tabbox">
          <span class="sp1"><p class="min">申请原因：</p><a class="man">{{datas.purpose}}</a></span>
        </div>
        <div v-show="datas.reason" style="margin-top:10px;height:50px" class="tabbox">
          <span class="sp1"><p class="min">驳回理由：</p><a style="font-weight:200;color: red" class="man">{{datas.reason}}</a></span>
        </div>
      </div>
      <div v-show="edit" style="width:100%;height:40px;margin-top:20px;">
        <div style="width:200px;margin: 0 auto;">
          <el-button type="danger" @click="Negate" >取消</el-button>
          <el-button type="primary" @click="gitact(1)" style='float:right;'>确认入库</el-button>
        </div>
      </div>
    </el-dialog>

  </div>
</template>
<script>
  import caigou from '@/components/MES/steps/caigou.vue'
  import { applyIn } from '@/api_bast/Finance.js'
  export default {
    name: 'decla_shens',
    components:{caigou},
    computed:{},
    data() {
      return {
        dialogVisibles:false,
        loading:false,
        dialogVisible:false,
        datas:{
          createdBy:'',//     创建人id
          createdTime:'',//   创建时间
          name:'',//          申请采购的物品名称
          typeId:'',//        型号
          amount:'',//;       数量
          model:'',//;        型号
          size:'',//;         尺寸
          provider:'',//;     供应商
          purpose:'',//;      采购原因
          goodsSku:'',//;     如果仓库中有该物品就填，没有就空着，后台自动生成
          remarks:'',//;      备注
          price:'',//         单价
        },
      }
    },
    props:{
      edit:Boolean
    },
    methods: {
      panertfn(item){
        this.datas = item
        this.Negate();
      },
      Negate(){this.dialogVisible = !this.dialogVisible},//显隐取反
      gitact(i){//提交数据
        this.$confirm('确认收到货并发起入库申请吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.loading=true;
          applyIn(this.datas.id).then(response => {
            this.loading = false;
            if(response.code==200){
              this.$notify.success({title: '完成',message:`入库申请已提交`});
              this.Negate();
              this.$parent.git_act();
            }
          })
        }).catch(() => {});
      },
    },
    mounted() {

    }
  }
</script>

<style scoped>
  .man{
    height: 100%;
    padding: 0 10px;
    /*border: 1px solid #DCDFE6;*/
    font-weight: bold;
  }
  .min{
    width:80px;
    text-align:right;
  }
  .sp1{
    float: left;
  }
  .sp2{
    float: right;
  }
  .tabbox{
    width:100%;
    height:40px;
    line-height: 30px;
    margin-top:23px;
  }
  .tabbox p{
    font-size:14px;
    /*font-weight: bold;*/
    /*color:#000000;*/

    /*margin-right:10px;*/
    float:left;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
    font-family:Source Han Sans CN;
  }
</style>
